﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CmdArgs.Settings
{
    /// <summary>
    /// Represents policy for count of option's parameters.
    /// </summary>
    public interface IOptionParametersCount
    {
        /// <summary>
        /// Determines whether the command line agument after the
        /// option with given (zero based) index should be treated as the option's parameter or not.
        /// </summary>
        /// <param name="parameterIndex">The index of command line argument after the option.
        /// For example first command line argument after the option has index 0 no matter
        /// where it is in the whole array of command line arguments.</param>
        /// <returns>
        /// <c>true</c> if the cmd argument with given index should be parsed as the option's parameter.
        /// </returns>
        bool Satisfies(int parameterIndex);

        /// <summary>
        /// This method shoud be used for validation after parsing the option's parameters.
        /// There might be for example not enough parameters.
        /// </summary>
        /// <param name="parametersCount">The parameters count.</param>
        /// <returns>
        /// 	<c>true</c> if the given count of parameters is valid; otherwise, <c>false</c>.
        /// </returns>
        bool IsValidCount(int parametersCount);

        /// <summary>
        /// Gets the error message used when the validation of count of parameters fails.
        /// </summary>
        string ErrorMessage { get; }

        /// <summary>
        /// Gets the string with the help for usage of given
        /// option with this parameters count policy.
        /// </summary>
        /// <remarks>
        ///     The string is appended immediately after the option name so
        ///     in most cases it will start with space.
        ///     <example>
        ///     The help for option named format will look like:
        ///     <code>-f{GetParametersListForHelp output}, --format{GetParametersListForHelp output}</code>
        ///     In this case:
        ///     <code>-f FORMAT, --format=FORMAT</code>
        /// </example>
        /// </remarks>
        /// <param name="parameterName">Name of the parameter. For more user friendly output.</param>
        /// <param name="forLongName">
        /// Whether the parameters list will be appended after the long name of option (true) or after short name (false).</param>
        /// <returns>The output as string.</returns>
        string GetParametersListForHelp(string parameterName, bool forLongName);
    }
}
